package com.senjoeson.publicsource;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * @author sunqiao
 * @date 2018/5/28 15:09
 */

public class MyPagerAdapter extends FragmentPagerAdapter {

    private String tilte[];
    private List<Fragment> mFragments;


    public MyPagerAdapter(FragmentManager fm) {
        super(fm);

    }


    public void setTilte(String[] tilte) {
        this.tilte = tilte;
    }

    public void setFragments(List<Fragment> fragments) {
        mFragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return tilte.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tilte[position];
    }
}
